﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11" />-->
<script src="My97DatePicker/WdatePicker.js"></script>
<script src="public/js/json2.js"></script>

<script language="javascript" for="DPSDK_OCX" event="OnCorrectTalkParamEvent(nTalkType, nAudioType, nAudioBit, nSampleRate, nTransMode)">
	var str = ("Correct Talk Param [nTalkType=" + nTalkType + "]" + " [nAudioType=" + nAudioType + "]" + " [nAudioBit=" + nAudioBit
		+ "]" + " [nSampleRate=" + nSampleRate + "]");
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnMediaDataFirstFrameEvent(szCameraID, nCameraIDLen, nFactoryType, nPlayMode)">
	var str = (" Media Data First Frame [szCameraID=" + szCameraID + "]" + " [nCameraIDLen=" + nCameraIDLen + "]" + " [nFactoryType=" + nFactoryType + "]"
		+ " [nPlayMode=" + nPlayMode + "]");
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnCorrectTalkParamEvent(nTalkType, nAudioType, nAudioBit, nSampleRate, nTransMode)">
	var str = ("Correct Talk Param [nTalkType=]" + nTalkType + " [nAudioType=]" + nAudioType + " [nAudioBit=]" + nAudioBit
		+ " [nSampleRate=]" + nSampleRate + " [nTransMode=]" + nTransMode );
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnDownloadRecordProgress(szFileName,fProgress)">
	document.getElementById("textDownloadProgress").innerText = fProgress;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnDownloadRecordComplete(szFileName)">
	document.getElementById("textDownloadProgress").innerText = 100;
	alert("下载完成!");
</script>

<script language="javascript" for="DPSDK_OCX" event="OnAlarmEvent(szAlarmId, szCameraId, szDeviceName, szChannelName, nAlarmType, nEventType, nLevel, nTime)">
    
	var str = ("OnAlarmEvent [szAlarmId=]" + szAlarmId + " [szCameraId=]" + szCameraId + "[szDeviceName=]" + szDeviceName
		+ "[szChannelName=]" + szChannelName + "[nAlarmType=]" + nAlarmType + "[nEventType=]" + nEventType + "[nLevel=]" + nLevel + "[nTime=]" + nTime);
	document.getElementById("GlobalInfo").innerText = str;
		
	if(8 == nAlarmType)
	{
		//alert(szChannelName);
	}
	else if((300 < nAlarmType)&&(nAlarmType < 1100))
	{
		//alert(szChannelName);
	}
	else
	{
		//alert(szCameraId);
	}
</script>

<script language="javascript" for="DPSDK_OCX" event="OnDevStatusEvent(szDevId, nStatus)">
	var str = "";    
	switch(nStatus)
	{
		case 1:
			//alert("设备上线！" + szDevId);
			str = "设备上线！" + szDevId;
            //ButtonGetDGroupInfo_onclick();
            ButtonStartRealplayByWndNo_onclick();
            //ButtonStartRealplayByWndNo_onclickSelect();
			break;
		case 2:
			//alert("设备离线！" + szDevId);
			str = "设备离线！" + szDevId;
			break;			
	}
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnNvrChannelStatusEvent(szChnlId, nStatus)">
	var str = "";    
	switch(nStatus)
	{
		case 1:
			str = "通道上线！" + szChnlId;
			break;
		case 2:
			str = "通道离线！" + szChnlId;
			break;			
	}
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnGeneralJsonCallBack(Json)">
	var str1 = "json返回结果：";
	var str = str1 + Json;
	document.getElementById("JsonResult").innerText = str;
	
	var jsonObj = JSON.parse(Json);
	var strMethod = jsonObj.method;
	
	if (strMethod == "cu.searchSnapPicUrl") {
		var obj = document.getElementById("DPSDK_OCX");
		var ftpInfo = obj.DPSDK_GetFTPInfo();
		var picurl = jsonObj.params.snapPicList[0].snapPicUrl;
		var ftpurl = ftpInfo + picurl;
		alert(ftpurl);
		document.getElementById("snapPicture").src = ftpurl;
	}
	else if (strMethod == "dms.getSnapPic") {
		var picdata = jsonObj.params.PicData;
		alert(picdata);
	}
	else if (strMethod == "Scs.NotifyBye")
	{
		alert("通话结束");
	}
</script>

<script language="javascript" for="DPSDK_OCX" event="OnServerStatusChangeEvent(nStatus)">
	var str = "";    
	switch(nStatus)
	{
		case 1:
			str = "服务上线！";
			var obj = document.getElementById("DPSDK_OCX");
			ShowCallRetInfo(obj.DPSDK_LoadDGroupInfo(), "加载组织结构");
			break;
		case 2:
			str = "服务离线！";
			break;			
	}
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnAsyncLoadDGroupInfoComplete(nRet, nGroupLen)">
	var str = ("AsyncLoadDGroupInfoComplete [nRet=]" + nRet + " [nGroupLen=]" + nGroupLen);
	document.getElementById("RetInfo").innerText = str;
	var obj = document.getElementById("DPSDK_OCX");
//	document.getElementById("DGroupInfo").innerText = obj.DPSDK_GetDGroupStr();
</script>

<script language="javascript" for="DPSDK_OCX" event="OnWndLBtnClick(nWndId, nWndNo, xPos, yPos)">
	var str = ("OnWndLBtnClick [nWndId=]" + nWndId + " [nWndNo=]" + nWndNo + " [xPos=]" + xPos + " [yPos=]" + yPos);
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnWndRBtnClick(nWndId, nWndNo, xPos, yPos)">
	var str = ("OnWndRBtnClick [nWndId=]" + nWndId + " [nWndNo=]" + nWndNo + " [xPos=]" + xPos + " [yPos=]" + yPos);
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnDoorStatusReportEvent(szCameraId, status, time)">
	var doorstatus = "";    
	switch(status)
	{
		case 1:
			doorstatus = "开门！";
			break;
		case 0:
			doorstatus = "关门！";
			break;
		case 2:
			doorstatus = "离线！";
			break;
	}
	var str = ("DoorStatusReport [szCameraId=]" + szCameraId + " [status=]" + doorstatus + " [time=]" + time);
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnNetAlarmHostStatusReportEvent(szDeviceId, nReportType, nOperationType, nStatus)">
	var strReportType = "";
	var strOperationType = "";
	var strStatus = "";
	switch(nReportType)
	{
		case 1:
			strReportType = "留守布防";
			break;
		case 2:
			strReportType = "防区旁路";
			break;
		default:
			strReportType = "未知";
			break;
	}
	switch(nOperationType)
	{
		case 1:
			strOperationType = "设备 布/撤防";
			break;
		case 2:
			strOperationType = "通道 布/撤防";
			break;
		case 3:
			strOperationType = "报警输出通道操作";
			break;
		default:
			strOperationType = "未知";
			break;
	}
	switch(nStatus)
	{
		case 1:
			strStatus = "布防/旁路";
			break;
		case 2:
			strStatus = "撤防/取消旁路";
			break;
		default:
			strStatus = "未知";
			break;
	}
	var str = ("网络报警主机状态上报 [szCameraId=]" + szDeviceId + " [ReportType=]" + strReportType + " [OperationType=]" + strOperationType + " [Status=]" + strStatus);
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnVideoAlarmHostStatusReportEvent(szDeviceId, nChannelNO, nStatus)">
	var strStatus = "";
	switch(nStatus)
	{
		case 1:
			strStatus = "针对设备布防";
			break;
		case 3:
			strStatus = "针对设备撤防";
			break;
		case 4:
			strStatus = "针对通道旁路";
			break;
		case 5:
			strStatus = "针对通道取消旁路";
			break;
		case 6:
			strStatus = "针对设备在家布防";
			break;
		case 7:
			strStatus = "针对设备外出布防";
			break;
		default:
			strStatus = "未知";
			break;
	}
	var str = ("视频报警主机状态上报 [szCameraId=]" + szDeviceId + " [ChannelNO=]" + nChannelNO + " [Status=]" + strStatus);
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnBayCarInfoEvent(szBayCarInfo)">
    
	document.getElementById("GlobalInfo").innerText = szBayCarInfo;
	alert(szBayCarInfo);
	
</script>

<script language="javascript" for="DPSDK_OCX" event="OnChannelViewInfoReportEvent(szCamearId, nDistance, nAngelH, nAzimuthH, nInclinationH)">
    
	var str = ("OnChannelViewInfoReportEvent [szCamearId=]" + szCamearId + " [nDistance=]" + nDistance + "[nAngelH=]" + nAngelH
		+ "[nAzimuthH=]" + nAzimuthH + "[nInclinationH=]" + nInclinationH );
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnAsyncLoginComplete(nRet)">
	if(nRet == 0)
	{
		bLogin = 1;
	}
	ShowCallRetInfo(nRet, "异步登录");
</script>

<script language="javascript" for="DPSDK_OCX" event="OnAsyncStartRealplayComplete(nRet, nWndId, nWndNo)">
	var str; 
	if(nRet == 0)
	{
		str = "异步播放视频成功，nWndId = " + nWndId + "，nWndNo = " + nWndNo;
		var szCameraId = document.getElementById("textCameraID").value;
		var obj = document.getElementById("DPSDK_OCX");
		var nWndNo = obj.DPSDK_GetSelWnd(gWndId);
		insertRealplayHistory(szCameraId);
		ShowCallRetInfo(obj.DPSDK_SetIvsShowFlagByWndNo(gWndId, nWndNo, 1, bIVS),"规则线显示");//打开规则线显示
		ShowCallRetInfo(obj.DPSDK_SetIvsShowFlagByWndNo(gWndId, nWndNo, 2, bIVS),"目标框显示");//打开目标框显示
		ShowCallRetInfo(obj.DPSDK_SetIvsShowFlagByWndNo(gWndId, nWndNo, 3, bIVS),"轨迹线显示");//打开轨迹线显示
	}
	else
	{
		str = "异步播放视频失败，错误码：" + nRet;
	}
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnAsyncStopRealplayComplete(nRet, nWndId, nWndNo)">
	var str; 
	if(nRet == 0)
	{
		str = "异步停止视频成功，nWndId = " + nWndId + "，nWndNo = " + nWndNo;
	}
	else
	{
		str = "异步停止视频失败，错误码：" + nRet;
	}
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnAsyncPtzDirectionComplete(nRet, szCameraId)">
	var str; 
	if(nRet == 0)
	{
		str = "异步云台方向控制成功，szCameraId = " + szCameraId;
	}
	else
	{
		str = "异步云台方向控制失败，错误码：" + nRet;
	}
	document.getElementById("GlobalInfo").innerText = str;
</script>

<script language="javascript" for="DPSDK_OCX" event="OnVtCallInviteCallback(szUserId)">
	var str = szUserId + "请求可视对讲";
	alert(str);
</script>

<script language="javascript" for="DPSDK_OCX" event="OnBusyVtCallCallback()">
	var str = "呼叫繁忙";
	document.getElementById("GlobalInfo").innerText = str;
</script>

<title>测试视频</title>
<link rel="stylesheet" type="text/css" href="public/css/DSSPlay.css"/>
	   <style type="text/css">
		   #monitoringChannelId option{
			   line-height: 30px;
		   }
	   </style>
<script src="public/js/ocxfun_new.js"></script>
	   <!--xml格式的组织结构转json获取-->
	   <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
	   <script type="text/javascript" src="http://www.jsons.cn/Down/jquery.xml2json.js"></script>
</head>
<body id="mbody" onload="init();"  onunload="ButtonLogout_onclick()">
<div id="mainbg clear">
<div id="main">
	    <div  id="RetInfo"></div>
		<div  id="GlobalInfo"></div>
		 <div class="box_top"></div>
		<div id="mviewl">
			<div id="obj">
				<object id="DPSDK_OCX" classid="CLSID:D3E383B6-765D-448D-9476-DFD8B499926D" style="width: 100%; height: 80%" codebase="DpsdkOcx.cab#version=1.0.0.0"></object>
			</div>
		</div>
</div>
<div class="rightDiv">
	<div>
    	通道<!--<input type="text" id="textCameraID" value="1000002$1$0$0" />-->
		<select id="monitoringChannelId" onchange="ButtonStartRealplayByWndNo_onclickSelect()" style="height: 30px;line-height: 30px; width: 210px;">
			<!--<option value="1000002$1$0$1">1000002$1$0$1</option>-->
			<!--<option value="1000002$1$0$2">1000002$1$0$2</option>
			<option value="1000002$1$0$3">1000002$1$0$3</option>
			<option value="1000002$1$0$4">1000002$1$0$4</option>-->
		</select>
		设置窗口数量：
		<input type="text" id="textWndNum" value="4" size=""/>
		<input type="button" id="buttonCreateWnd" value="设置" class="button" onclick="return ButtonCreateWnd_onclick()" />
		<input type="button" id="buttonLogout" value="登出" class="button" onclick="return ButtonLogout_onclick()" />
	</div>
	<ul id="tab_con">
	<li id="tab_con_1" style="display:none;">
	<div style="">
		<div style="width:50%; float:left;display: block">
			<input type="text" id="textIP" value="58.58.232.70"  size="10"/>
			<input type="text" id="textPort" value="9000" size="10"/>
			<input type="text" id="textUser" value="test" size="10"/>
			<input type="text" id="textPassword" value="a123456789" size="10"/>
			<input type="button" id="buttonLogin" value="登录" class="button" onclick="return ButtonLogin_onclick()" />
			<input type="button" id="buttonAsyncLogin" value="异步登录" class="button" onclick="return ButtonAsyncLogin_onclick()" />
			<!--<input type="button" id="buttonLogout" value="登出" class="button" onclick="return ButtonLogout_onclick()" />-->
			<input type="button" id="buttonLoadDGroupInfo" value="加载组织结构" class="button" onclick="return ButtonLoadDGroupInfo_onclick()" />
			<input type="button" id="buttonAsyncLoadDGroupInfo" value="异步加载组织结构" class="button" onclick="return ButtonAsyncLoadDGroupInfo_onclick()" />
			<input type="button" id="buttonGetDGroupInfo" value="获取组织结构" class="button" onclick="return ButtonGetDGroupInfo_onclick()" />
			<input type="button" id="buttonConnectDmsByChnlId" value="根据通道ID连接DMS" class="button" onclick="return ButtonConnectDmsByChnlId_onclick()" />
		</div>
		<div style="width: 50%;height: 150px;overflow: auto; float: left; display: block" id="DGroupInfo"></div>
		<div style="clear:both"></div>
	</div>
	<div style="border:1px solid white;padding:5px;display: block">
		<input type="button" id="logPathName" value="设置log文件" onclick="return SetLog()" />
		 <input type="text" id="textType" value="0" size="2"/>
		 <input type="text" id="textMode" value="0" size="2"/>
		<input type="button" id="setTypeMode" value="设置显示模式" onclick="return SetControlButtonShowMode()" />
		<input type="button" id="getGPS" value="获取经纬度" onclick="return GetGps()" />&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" id="StartMonitor" value="开启崩溃自动生成dump" onclick="return StartMonitor()" />
		<input type="button" id="StopMonitor" value="关闭崩溃自动生成dump" onclick="return StopMonitor()" />
	</div>
	</li>
	<li id = "tab_con_2" style="display: none;">
	<div style="padding-top:20px; display:none">
		<div style="margin-left: 10px;">
			实时视频</br>
			<select id="selectStreamType" >
				<option value="1">主码流</option>
				<option value="2">辅码流</option>
			</select>
			<select id="selectMediaType" >
				<option value="1">视频</option>
				<option value="2">音频</option>
				<option value="3">视频 + 音频</option>
			</select>
			<select id="selectTransType" >
				<option value="1">TCP</option>
				<option value="0">UDP</option>
			</select>
			<input type="text" id="textFtpIp" value="58.58.232.70" size="10" />
			<input type="text" id="textFtpName" value="test" size="10" /> </br>
			<input type="text" id="textFtpPwd" value="a123456789" size="10" />
		</div>
	</div>
	</li>
	</ul>
</div>
</div>
<script type="text/javascript">
    $(document).ready(function(){

    });
</script>
</body>
</html>